/*


 */

package jas.bank;

import jas.http.logging.DateRequestLineResponseCodeIPHttpLogger;
import jas.http.logging.HttpLogger;
import jas.rpc.server.Base64ServerSerializer;
import jas.rpc.server.ObjectIdBank;
import jas.rpc.server.ObjectIdBankImpl;
import jas.rpc.http.RpcHttpResponseFactory;
import jas.rpc.http.RpcHttpServerFormatterImpl;
import jas.rpc.server.RpcListenerImpl;
import jas.http.server.HttpServer;
import jas.http.server.NullLogger;
import jas.http.server.StdHttpServerFactory;

/**
 *
 *
 */
public class BankServer {
    
    public static void main(String[] args) {
        HttpLogger logger = new NullLogger();
        if (args.length > 0 && args[0].equals("-log")) {
            logger = null;
        }
        ObjectIdBank ids = new ObjectIdBankImpl();
        
        HttpServer server = new HttpServer(new StdHttpServerFactory(logger, new RpcHttpResponseFactory(new RpcListenerImpl(), new RpcHttpServerFormatterImpl(new Base64ServerSerializer(), ids))));
        
        BankImpl bank = new BankImpl();
        ids.bind("bank", bank);
        
        new Thread(server).start();
        
        
    }
    
}
